package com.yuan.blog.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @program: blog
 * @description:
 * @author: yuan_boss
 * @create: 2022-12-18 13:38
 **/

@Controller
@Slf4j
public class PageController {


    @GetMapping("/{page}.html")
    public String page1(@PathVariable String page){
        log.info("page = " + page);
        return page;
    }

    // system/index.html
    // view/index.html
    // 二层路径
    @GetMapping("/{model}/{page}.html")
    public String page2(@PathVariable String model, @PathVariable String page) {
        System.out.println("model = " + model + ", page = " + page);
        return model + "/" + page; // "/templates/"+system+"/"+index +".html"
    }

    // system/site/login.html
    @GetMapping("/{model}/{path}/{page}.html")
    public String page3(@PathVariable String model, @PathVariable String path, @PathVariable String page) {
        System.out.println("model = " + model + ", path = " + path + ", page = " + page);
        return model + "/" + path + "/" + page; // "/templates/"+system+"/"+"/site/"+index +".html"
    }

}
